
<?php	
	
	class country extends database
	{
		var $connection = '';	

		function country()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from vnf_country";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_country";			
						
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
        
		function AddCountry($code, $name, $order)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Insert into vnf_country(`country_code`, `country_name`, `order`) values('".$code."', '".$name."', '".$order."')";
            //echo $sql;
			$this->setQuery($sql);
			$this->query();
		}
		
		function UpdateCountry( $id, $code, $name, $order)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_country set `country_code`='".$code."', `country_name`='".$name."', `order` = '".$order."' ";
			$sql .= " where country_id=".$id;			
		//	echo $sql;
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOneCountry($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_country where country_id=".$id." ";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteCountry($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Delete from vnf_country";
			$sql .= " where country_id=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
		
	}
?>